package com.ty.util;

import com.ty.bean.Courier;
import com.ty.bean.User;

import javax.servlet.http.HttpSession;

/**
 * @author 田野
 */
public class UserUtil {
    public static String getUserName(HttpSession session){
        // TODO:将这个改成动态的
        return (String) session.getAttribute("admin");

    }

    public static String getUserPhone(HttpSession session){
        // TODO:还没有编写柜子端，未存储任何的录入人的信息，先固定的设置一个sysPhone，后期再改
        return "18888888888";
    }

    public static String getLoginSMS(HttpSession session, String userPhone){
        return (String) session.getAttribute(userPhone);
    }

    public static void setLoginSMS(HttpSession session, String userPhone, String code){
        session.setAttribute(userPhone, code);
    }

    public static void setWxUser(HttpSession session, User user){
        session.setAttribute("WxUser", user);
    }

    public static User getWxUser(HttpSession session){
        return (User) session.getAttribute("WxUser");
    }

    public static void setWxCourier(HttpSession session, Courier courier){
        session.setAttribute("WxCourier", courier);
    }

    public static Courier getWxCourier(HttpSession session){
        return (Courier) session.getAttribute("WxCourier");
    }


}
